<%@ page language="java" import="java.io.File,com.fourtwoeight.controllers.WebConstants" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String name = ((File)request.getAttribute(WebConstants.FILE)).getName();

String next = (String)request.getAttribute(WebConstants.NEXT);
String previous = (String)request.getAttribute(WebConstants.PREVIOUS);

Object imagesDirectoryURL = request.getSession().getAttribute(WebConstants.IMAGE_DIRECTORY_URL);

String mode = "VIEW";
if(request.getParameter("mode") != null) {
	mode = "EDIT";
}
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>


    <base href="<%=basePath%>">
    
	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
	
	<title>428 WILSON.COM - Image Library - Displaying <%=name%></title>
	
	<link href="<%=basePath%>/images/styles.css" rel="stylesheet">

	<script language="javascript" src="<%=basePath%>/images/x.js"></script>

	<script language="JavaScript">
	function saveCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000))
			var expires = "; expires="+date.toGMTString()
		}
		else expires = ""
		document.cookie = name+"="+value+expires+"; path=/"
	}
	function readCookie(name) {
		var nameEQ = name + "="
		var ca = document.cookie.split(';')
		for(var i=0;i<ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length)
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
		}
		return '';
	}
	function setSlideShowCookie() {
		saveCookie('slideShow', 'true');
	}
	
	function moveOn() {
		document.location.href = 'IMGP8392.html';
	}
	function stopSlideShow() {
		try {
			clearTimeout(timeout);
		} catch(e) {
		}
		saveCookie('slideShow', '', -1);
	}
	
	var timeout = null;
	function initPage() {
		if (readCookie('slideShow') == 'true') {
		
			timeout = setTimeout('moveOn()', 4000);
		
	
		}
		resizeHandler();
	}
	function submitForm() {
		document.myform.submit();
	}
		
	function resizeHandler() {
		xHeight('divActivity', parseInt(xClientHeight(),10) + parseInt(xScrollTop(),10));
	}
	window.onresize = resizeHandler
	window.onscroll = resizeHandler
	</script>
</head>

<body onload="initPage();" id="slide">

<div style="height: 731px;" id="divActivity">

<div id="divImageActivity">
<table border="0" cellpadding="0" cellspacing="0" width="185">
	<tbody>
		<tr>
			<td colspan="3" class="ImagePaneHeader" width="185">Image activities</td>
		</tr>
		
		<tr>		
			<td class="ImagePaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
			<td class="ImagePaneRow" width="183"><a href="<%= request.getContextPath()%>/DisplayThumbnails.do?currentDirectory=<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>" class="ImagePaneRow"><img src="<%=basePath%>/images/FolderUp.gif" style="margin-right: 5px;" border="0">Back to thumbs page</a></td>
			<td class="ImagePaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
		</tr>	
	</tbody>
</table>
</div>


<div id="divInfoActivity">
<form name="myform" 
	  method="post" 
	  action="<%=basePath%>UpdateNotes.do">
	  
	  <% if(mode.equals("EDIT")) { %>
	  	<input type="hidden" 
				name="<%=com.fourtwoeight.controllers.WebConstants.FILE%>" 
				value="<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>/<%=name%>"/>
		<input type="hidden" 
				name="<%=com.fourtwoeight.controllers.WebConstants.IMAGE_NOTES_FILENAME%>" 
				value="<%=request.getAttribute(com.fourtwoeight.controllers.WebConstants.IMAGE_NOTES_FILENAME)%>"/>
	  <% }%>
	  
<table id="Table1" border="0" cellpadding="0" cellspacing="0" width="185">
<tbody><tr>
	<td colspan="3" class="InfoPaneHeader" width="185">Information</td>
</tr>
<tr>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
	<td class="InfoPaneRow" width="183"><strong><%=name%></strong></td>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
</tr>

	
<% if(mode.equals("EDIT")) { %>



	<tr>
		<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
			
			<td class="InfoPaneRow" width="183">	
				<textarea name="<%=com.fourtwoeight.controllers.WebConstants.IMAGE_NOTES%>" 
						cols=17 
						rows=17><%=request.getAttribute(com.fourtwoeight.controllers.WebConstants.IMAGE_NOTES_RAW)%></textarea>
			</td>
	
		<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
	</tr>
	<tr>
		<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
		<td class="InfoPaneRow" width="183"><a href="javascript:submitForm();">Save notes</a></td>
		<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
	</tr>



<% } else { %>

<tr>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
	<td class="InfoPaneRow" width="183"><%=request.getAttribute(com.fourtwoeight.controllers.WebConstants.IMAGE_NOTES)%></td>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
</tr>
<tr>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
	<td class="InfoPaneRow" width="183"><a href="<%= request.getContextPath()%>/DisplayImage.do?file=<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>/<%=name%>&mode=edit">Edit notes</a></td>
	<td class="InfoPaneFrame" width="1"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
</tr>
<% } %>	
	




<tr>
	<td colspan="3" class="InfoPaneFrame" width="185"><img src="<%=basePath%>/images/1x1.gif" height="1" width="1"></td>
</tr>
</tbody></table>
</form>
</div>

</div>

<div id="divMainSlideHeader"><%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>/<%=name%></div>

<div id="divMain" align="left">

<table border=0 width="100">
	<tr>
		<td>
		<% if(previous != null) { %>
			<a href="<%= request.getContextPath()%>/DisplayImage.do?file=<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%><%=previous%>"><img border="no" src="<%=basePath%>/images/previous.png"></a>
		<% } %>
		</td>
		<td>
		<% if(next != null) { %>
			<a href="<%= request.getContextPath()%>/DisplayImage.do?file=<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%><%=next%>"><img border="no" src="<%=basePath%>/images/next.png"></a>
		<% } %>
		</td>
		</tr>
</table>
<table border=0>
	<tr>
		<td>
<a href="<%= request.getContextPath()%>/<%=imagesDirectoryURL %>/<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>/<%=((File)request.getAttribute(WebConstants.FILE)).getName()%>" target="_blank">
<img border="0" 
	src="<%= request.getContextPath()%>/<%=imagesDirectoryURL %>/<%=request.getSession().getAttribute(WebConstants.CURRENT_DIRECTORY)%>/_slides/slides_<%=((File)request.getAttribute(WebConstants.FILE)).getName()%>">
</a>
		</td>
	</tr>
</table>

<br>


</div>
</body></html>